<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Jialeo\LaravelSchemaExtend\Schema;

class AlertUserIdToFeishuCallingCardUsersStoriesLog extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        DB::statement("ALTER TABLE feishu_calling_card_users_stories_log MODIFY COLUMN usersId varchar(32) NOT NULL DEFAULT '' COMMENT '用户ID 加盟商名片微信小程序用户表id' AFTER storiesId");

        Schema::table('feishu_calling_card_users_stories_log', function (Blueprint $table) {
            $table->tinyInteger('source')->default(0)->comment('来源 1-微信加盟小程序 2-微信服务号')->after('usersId');
            $table->unsignedTinyInteger('isDeleted')->default(0);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('feishu_calling_card_users_stories_log', function (Blueprint $table) {
            $table->dropColumn('source');
            $table->dropColumn('isDeleted');
        });
    }
}
